<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*"%>
<%@page import="java.sql.*"%>
<%@page import="java.text.NumberFormat.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Insert title here</title>
</head>
<body onload="loadGraph()">
<%
	Random random = new Random();
%>
<%
	double[][] res = new double[5][100];
	//ArrayList al = new ArrayList();
	Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
	String connectionUrl = "jdbc:sqlserver://localhost:1438;database=HKBANK;user=sa;password=1111";
	Connection conn = DriverManager.getConnection(connectionUrl);
	Statement stmt = conn
			.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
					ResultSet.CONCUR_UPDATABLE);
	String sql = "select top 100 * from last order by id desc";
	ResultSet rs = stmt.executeQuery(sql);
	int i = 0;
	while (rs.next()) {
%>
<%
	res[0][i] = rs.getDouble(3);
		res[1][i] = rs.getDouble(4);
		res[2][i] = rs.getDouble(5);
		res[3][i] = rs.getDouble(6);
		res[4][i] = rs.getDouble(7);
		i++;
%>
<%
	}
%>

<%
	//out.println(al.size());
	rs.close();
	stmt.close();
	conn.close();
	////src="http://chart.apis.google.com/chart?chxr=0,0,50,1&chxt=y,x&chs=440x220&cht=lxy&chco=FF0000&chd=t:-1|<%for (int i = 0; i < al.size(); i++) {
%>
<img
	src="

http://chart.apis.google.com/chart?chs=440x220&cht=lxy&chco=3072F3,FF0000,FF9900,FF9900,FF9900&chds=0,100,0,100,0,100,0,100,0,100,0,100,0,105,0,100,-5,100,-5,100&chd=t:10,20,40,80,90,95,99|<%for (int idx = 0; idx < 100; idx++) {
				if (idx != 99) {
					out.println(res[0][idx] + ",");
				} else {
					out.println(res[0][idx]);
				}
			}%>|-1|4,5,6|-1|7,8,9|-1|10,11,12|-1|13,14,15&chdl=USD|EUR|GBP|JPY|CHF&chdlp=b&chls=2,4,1|1|1|1|1&chma=5,5,5,25

" />

</body>
</html>